﻿$filePath = "D:\Docs\数据同步\对接表数据汇总.txt";
$content = Get-Content $filePath;
$lst = $content;
#format output
$format = "insert into hvr_action (CHN_NAME, GRP_NAME, TBL_NAME, ACT_NAME, ACT_PARAMETERS) values ('yy', 'TGT', '{0}', 'Restrict', '/RefreshCondition=`"{{{1}}} like ''520100%''`"');";
$output = "";
foreach ($line in $lst)
{
   $items = $line.Split("	",[StringSplitOptions]::RemoveEmptyEntries);
   if ($items.Length -lt 3)
   {
       continue;
   }
   $flag = $items[0];
    $tableName = $items[1].ToLower();
   $fieldNames = $items[2].Split(",",[StringSplitOptions]::RemoveEmptyEntries);
 
     $fieldName = $fieldNames[0].ToLower();
     $str =  $format -F $tableName,$fieldName;
     $output +=  ($str +[System.Environment]::NewLine);
}

$output >> "f:/ttt_hvr_action.txt";
